<?php
  require_once '../../Helpers/DbHelper.php';
  require_once '../../Controllers/AdminController.php';
  require_once '../../Controllers/UserController.php';
  require_once '../../Helpers/PathHelper.php';
  //
  $u = new UserController();
  $u->evaluatePagePermission(UserController::ADMINISTRATOR);
  //
  if(isset($_POST))
  {
    if(isset($_POST['delete']) && !empty($_GET))
    {
      $id = $_GET['id'];
      $c = new AdminController();
      $c->removeSubject($id);
      //
      header('Location: manage_year_level.php');
    }
    else if(isset($_POST['cancel']))
      header('Location: manage_year_level.php');
  }
?>
<html>
  <head>
    <title>School Enrollment :: Delete Subject</title>
    <?php
      require_once '../commons.php';
      renderHeaderStyles() ;
    ?>
    </head>
  <div class="container">
    <?php renderAdminNav(); ?>
    <h1>Delete Subject</h1>
    <form name="subject-form" method="post">
      <strong>Are you sure you want to delete the selected subject? This action cannot be undone.</strong><br /><br />
      <input type="submit" name="delete" value="Delete" />
      <input type="submit" name="cancel" value="Cancel" />
    </form>
    <hr />
  </div>
</html>